#ifndef PID_H
#define PID_H
#include <QObject>
#include <QTimer>
#include <QVector>
#include <vector>
#include <qwt_plot_curve.h>
#include "quanser.h"


class pid:public QObject
{
Q_OBJECT
public:
    QTimer *Timer;
    double kp,ki,kd;
    double intErro;
    double setPoint;
    static double controlSignal;
    static double erroPast;
    static double y;
   // std::vector<double> controlSignalVec;


    QwtPlotCurve ControlSignalCurve;
    QwtPlotCurve Level1Curve;
    QwtPlotCurve Level2Curve;
    QwtPlotCurve ErroCurve;
    QwtPlotCurve SetPointCurve;

    static QVector<double> TimePoints;
    QVector<double> ControlSignalPoints;
    QVector<double> Level1Points;
    QVector<double> Level2Points;
    QVector<double> ErroPoints;
    QVector<double> SetPointPoints;

    static double time;
    int timePast;
    int count;
    static pid *getInstance();

public slots:
    void nextStep();
    void start();
    void setSetpoint(double);
    void setKp(double);
    void setKi(double);
    void setKd(double);



private:
    static pid *instance;
    pid();

};

#endif // PID_H
